home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_09 / xmpl_06.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  830 b   |  41 lines  |  [TEXT/R*ch]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 9, example 6
  5.  
  6. module XYZ
  7.     uses ScriptX
  8.     exports x, y, z
  9. end
  10. in module XYZ
  11. global x:10, y:"foo", z:#(56,567)
  12.  
  13. -- Import all from XYX and prefix the variables with XYZ_
  14. module XYZprefix1
  15.     uses ScriptX
  16.     uses XYZ with
  17.         prefix XYZ_
  18.     end
  19. end
  20. in module XYZprefix1
  21. -- trying to print x in this module should generate an exception
  22. print x
  23. print XYZ_x
  24. print XYZ_y
  25.  
  26. -- Now do both a prefix and a rename. The rename overrides
  27. -- the prefix for those specific variables.
  28. module XYZprefix2
  29.     uses ScriptX
  30.     uses XYZ with
  31.         prefix ext_
  32.         renames x:fumbleWhizzy
  33.     end
  34. end
  35. in module XYZprefix2
  36. -- trying to print ext_x in this module should generate an exception
  37. -- since we overrode the definition of ext_x by renaming it
  38. print ext_x
  39. print ext_y
  40. print fumbleWhizzy
  41. -->>>